Integrand size = 33, antiderivative size = 54 \[ \int \frac {A+B \cos (c+d x)+C \cos ^2(c+d x)}{a+a \cos (c+d x)} \, dx=\frac {(B-C) x}{a}+\frac {C \sin (c+d x)}{a d}+\frac {(A-B+C) \sin (c+d x)}{a d (1+\cos (c+d x))} \]
Time = 0.56 (sec) , antiderivative size = 67, normalized size of antiderivative = 1.24 \[ \int \frac {A+B \cos (c+d x)+C \cos ^2(c+d x)}{a+a \cos (c+d x)} \, dx=\frac {\sin (c+d x) \left (\frac {A-B+2 C+C \cos (c+d x)}{1+\cos (c+d x)}-\frac {(B-C) \arcsin (\cos (c+d x))}{\sqrt {\sin ^2(c+d x)}}\right )}{a d} \]
(Sin[c + d*x]*((A - B + 2*C + C*Cos[c + d*x])/(1 + Cos[c + d*x]) - ((B - C )*ArcSin[Cos[c + d*x]])/Sqrt[Sin[c + d*x]^2]))/(a*d)
Time = 0.41 (sec) , antiderivative size = 56, normalized size of antiderivative = 1.04, number of steps used = 6, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.182, Rules used = {3042, 3502, 3042, 3214, 3042, 3127}
Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.
\(\displaystyle \int \frac {A+B \cos (c+d x)+C \cos ^2(c+d x)}{a \cos (c+d x)+a} \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {A+B \sin \left (c+d x+\frac {\pi }{2}\right )+C \sin \left (c+d x+\frac {\pi }{2}\right )^2}{a \sin \left (c+d x+\frac {\pi }{2}\right )+a}dx\) |
\(\Big \downarrow \) 3502 |
\(\displaystyle \frac {\int \frac {a A+a (B-C) \cos (c+d x)}{\cos (c+d x) a+a}dx}{a}+\frac {C \sin (c+d x)}{a d}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {\int \frac {a A+a (B-C) \sin \left (c+d x+\frac {\pi }{2}\right )}{\sin \left (c+d x+\frac {\pi }{2}\right ) a+a}dx}{a}+\frac {C \sin (c+d x)}{a d}\) |
\(\Big \downarrow \) 3214 |
\(\displaystyle \frac {a (A-B+C) \int \frac {1}{\cos (c+d x) a+a}dx+x (B-C)}{a}+\frac {C \sin (c+d x)}{a d}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {a (A-B+C) \int \frac {1}{\sin \left (c+d x+\frac {\pi }{2}\right ) a+a}dx+x (B-C)}{a}+\frac {C \sin (c+d x)}{a d}\) |
\(\Big \downarrow \) 3127 |
\(\displaystyle \frac {\frac {a (A-B+C) \sin (c+d x)}{d (a \cos (c+d x)+a)}+x (B-C)}{a}+\frac {C \sin (c+d x)}{a d}\) |
(C*Sin[c + d*x])/(a*d) + ((B - C)*x + (a*(A - B + C)*Sin[c + d*x])/(d*(a + a*Cos[c + d*x])))/a
3.4.42.3.1 Defintions of rubi rules used
Int[((a_) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> Simp[-Cos[c + d*x]/(d*(b + a*Sin[c + d*x])), x] /; FreeQ[{a, b, c, d}, x] && EqQ[a^2 - b ^2, 0]
Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])/((c_.) + (d_.)*sin[(e_.) + (f_. )*(x_)]), x_Symbol] :> Simp[b*(x/d), x] - Simp[(b*c - a*d)/d Int[1/(c + d *Sin[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0]
Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*sin[(e_.) + (f_.)*(x_)] + (C_.)*sin[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[(-C)*Co s[e + f*x]*((a + b*Sin[e + f*x])^(m + 1)/(b*f*(m + 2))), x] + Simp[1/(b*(m + 2)) Int[(a + b*Sin[e + f*x])^m*Simp[A*b*(m + 2) + b*C*(m + 1) + (b*B*(m + 2) - a*C)*Sin[e + f*x], x], x], x] /; FreeQ[{a, b, e, f, A, B, C, m}, x] && !LtQ[m, -1]
Time = 1.70 (sec) , antiderivative size = 43, normalized size of antiderivative = 0.80
method | result | size |
parallelrisch | \(\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (C \cos \left (d x +c \right )+A -B +2 C \right )+d x \left (B -C \right )}{a d}\) | \(43\) |
derivativedivides | \(\frac {A \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-B \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) C +\frac {2 C \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )}+2 \left (B -C \right ) \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d a}\) | \(87\) |
default | \(\frac {A \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-B \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) C +\frac {2 C \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )}+2 \left (B -C \right ) \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d a}\) | \(87\) |
risch | \(\frac {B x}{a}-\frac {C x}{a}-\frac {i {\mathrm e}^{i \left (d x +c \right )} C}{2 a d}+\frac {i {\mathrm e}^{-i \left (d x +c \right )} C}{2 a d}+\frac {2 i A}{d a \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}-\frac {2 i B}{d a \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}+\frac {2 i C}{d a \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}\) | \(122\) |
norman | \(\frac {\frac {\left (B -C \right ) x}{a}+\frac {\left (B -C \right ) x \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a}+\frac {\left (A -B +C \right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a d}+\frac {\left (A -B +3 C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{a d}+\frac {2 \left (B -C \right ) x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a}+\frac {2 \left (A -B +2 C \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a d}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{2}}\) | \(146\) |
Time = 0.26 (sec) , antiderivative size = 62, normalized size of antiderivative = 1.15 \[ \int \frac {A+B \cos (c+d x)+C \cos ^2(c+d x)}{a+a \cos (c+d x)} \, dx=\frac {{\left (B - C\right )} d x \cos \left (d x + c\right ) + {\left (B - C\right )} d x + {\left (C \cos \left (d x + c\right ) + A - B + 2 \, C\right )} \sin \left (d x + c\right )}{a d \cos \left (d x + c\right ) + a d} \]
((B - C)*d*x*cos(d*x + c) + (B - C)*d*x + (C*cos(d*x + c) + A - B + 2*C)*s in(d*x + c))/(a*d*cos(d*x + c) + a*d)
Leaf count of result is larger than twice the leaf count of optimal. 330 vs. \(2 (41) = 82\).
Time = 0.72 (sec) , antiderivative size = 330, normalized size of antiderivative = 6.11 \[ \int \frac {A+B \cos (c+d x)+C \cos ^2(c+d x)}{a+a \cos (c+d x)} \, dx=\begin {cases} \frac {A \tan ^{3}{\left (\frac {c}{2} + \frac {d x}{2} \right )}}{a d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + a d} + \frac {A \tan {\left (\frac {c}{2} + \frac {d x}{2} \right )}}{a d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + a d} + \frac {B d x \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )}}{a d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + a d} + \frac {B d x}{a d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + a d} - \frac {B \tan ^{3}{\left (\frac {c}{2} + \frac {d x}{2} \right )}}{a d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + a d} - \frac {B \tan {\left (\frac {c}{2} + \frac {d x}{2} \right )}}{a d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + a d} - \frac {C d x \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )}}{a d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + a d} - \frac {C d x}{a d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + a d} + \frac {C \tan ^{3}{\left (\frac {c}{2} + \frac {d x}{2} \right )}}{a d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + a d} + \frac {3 C \tan {\left (\frac {c}{2} + \frac {d x}{2} \right )}}{a d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + a d} & \text {for}\: d \neq 0 \\\frac {x \left (A + B \cos {\left (c \right )} + C \cos ^{2}{\left (c \right )}\right )}{a \cos {\left (c \right )} + a} & \text {otherwise} \end {cases} \]
Piecewise((A*tan(c/2 + d*x/2)**3/(a*d*tan(c/2 + d*x/2)**2 + a*d) + A*tan(c /2 + d*x/2)/(a*d*tan(c/2 + d*x/2)**2 + a*d) + B*d*x*tan(c/2 + d*x/2)**2/(a *d*tan(c/2 + d*x/2)**2 + a*d) + B*d*x/(a*d*tan(c/2 + d*x/2)**2 + a*d) - B* tan(c/2 + d*x/2)**3/(a*d*tan(c/2 + d*x/2)**2 + a*d) - B*tan(c/2 + d*x/2)/( a*d*tan(c/2 + d*x/2)**2 + a*d) - C*d*x*tan(c/2 + d*x/2)**2/(a*d*tan(c/2 + d*x/2)**2 + a*d) - C*d*x/(a*d*tan(c/2 + d*x/2)**2 + a*d) + C*tan(c/2 + d*x /2)**3/(a*d*tan(c/2 + d*x/2)**2 + a*d) + 3*C*tan(c/2 + d*x/2)/(a*d*tan(c/2 + d*x/2)**2 + a*d), Ne(d, 0)), (x*(A + B*cos(c) + C*cos(c)**2)/(a*cos(c) + a), True))
Leaf count of result is larger than twice the leaf count of optimal. 165 vs. \(2 (54) = 108\).
Time = 0.29 (sec) , antiderivative size = 165, normalized size of antiderivative = 3.06 \[ \int \frac {A+B \cos (c+d x)+C \cos ^2(c+d x)}{a+a \cos (c+d x)} \, dx=-\frac {C {\left (\frac {2 \, \arctan \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1}\right )}{a} - \frac {2 \, \sin \left (d x + c\right )}{{\left (a + \frac {a \sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}}\right )} {\left (\cos \left (d x + c\right ) + 1\right )}} - \frac {\sin \left (d x + c\right )}{a {\left (\cos \left (d x + c\right ) + 1\right )}}\right )} - B {\left (\frac {2 \, \arctan \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1}\right )}{a} - \frac {\sin \left (d x + c\right )}{a {\left (\cos \left (d x + c\right ) + 1\right )}}\right )} - \frac {A \sin \left (d x + c\right )}{a {\left (\cos \left (d x + c\right ) + 1\right )}}}{d} \]
-(C*(2*arctan(sin(d*x + c)/(cos(d*x + c) + 1))/a - 2*sin(d*x + c)/((a + a* sin(d*x + c)^2/(cos(d*x + c) + 1)^2)*(cos(d*x + c) + 1)) - sin(d*x + c)/(a *(cos(d*x + c) + 1))) - B*(2*arctan(sin(d*x + c)/(cos(d*x + c) + 1))/a - s in(d*x + c)/(a*(cos(d*x + c) + 1))) - A*sin(d*x + c)/(a*(cos(d*x + c) + 1) ))/d
Time = 0.31 (sec) , antiderivative size = 88, normalized size of antiderivative = 1.63 \[ \int \frac {A+B \cos (c+d x)+C \cos ^2(c+d x)}{a+a \cos (c+d x)} \, dx=\frac {\frac {{\left (d x + c\right )} {\left (B - C\right )}}{a} + \frac {A \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + C \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{a} + \frac {2 \, C \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1\right )} a}}{d} \]
((d*x + c)*(B - C)/a + (A*tan(1/2*d*x + 1/2*c) - B*tan(1/2*d*x + 1/2*c) + C*tan(1/2*d*x + 1/2*c))/a + 2*C*tan(1/2*d*x + 1/2*c)/((tan(1/2*d*x + 1/2*c )^2 + 1)*a))/d
Time = 1.53 (sec) , antiderivative size = 65, normalized size of antiderivative = 1.20 \[ \int \frac {A+B \cos (c+d x)+C \cos ^2(c+d x)}{a+a \cos (c+d x)} \, dx=\frac {x\,\left (B-C\right )}{a}+\frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (A-B+C\right )}{a\,d}+\frac {2\,C\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{d\,\left (a\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+a\right )} \]